﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My;
    using ACCOUNTING.My.Resources;
    using C1.Win.C1FlexGrid;
    using C1.Win.C1FlexGrid.Util.BaseControls;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_HangTrenDuongVe : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("CboHienThi")]
        private ComboBox _CboHienThi;
        [AccessedThroughProperty("CboKho")]
        private ComboBox _CboKho;
        [AccessedThroughProperty("CmdCancel")]
        private Button _CmdCancel;
        [AccessedThroughProperty("CmdOK")]
        private Button _CmdOK;
        [AccessedThroughProperty("CmdPrint")]
        private Button _CmdPrint;
        [AccessedThroughProperty("Label1")]
        private Label _Label1;
        [AccessedThroughProperty("Label13")]
        private Label _Label13;
        [AccessedThroughProperty("Label2")]
        private Label _Label2;
        [AccessedThroughProperty("Panel1")]
        private Panel _Panel1;
        [AccessedThroughProperty("Panel2")]
        private Panel _Panel2;
        [AccessedThroughProperty("TxtNgayChungTu")]
        private DateTimePicker _TxtNgayChungTu;
        [AccessedThroughProperty("TxtTimMa")]
        private TextBox _TxtTimMa;
        [AccessedThroughProperty("txtTimTen")]
        private TextBox _txtTimTen;
        [AccessedThroughProperty("VSlist")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VSlist;
        private IContainer components;
        private bool mAllowAdd;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mAllowView;
        private DataTable pData;

        [DebuggerNonUserCode]
        public Frm_HangTrenDuongVe()
        {
            base.Load += new EventHandler(this.Frm_HangTrenDuongVe_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.InitializeComponent();
        }

        private void CmdCancel_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void CmdOK_Click(object sender, EventArgs e)
        {
            if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboKho.SelectedValue), "", modGeneral.TypeOfValue.String).ToString().Trim() == "")
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn phải chọn kho h\x00e0ng!", ""));
                this.CboKho.Focus();
            }
            else
            {
                this.LoadData();
            }
        }

        private void CmdPrint_Click(object sender, EventArgs e)
        {
            this.PrintReport();
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void Frm_HangTrenDuongVe_Load(object sender, EventArgs e)
        {
            LVYModule.GetUserRight(ref this.mAllowView, ref this.mAllowDel, ref this.mAllowEdit, ref this.mAllowAdd, Conversions.ToString(this.Tag), modGeneral.H_USERNAME);
            if (!this.mAllowView)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn kh\x00f4ng c\x00f3 quyền xem, li\x00ean hệ với người quản trị để biết th\x00eam chi tiết.", ""));
                this.Dispose();
            }
            else
            {
                BuildComboModule.BuildCombo(this.CboKho, modGeneral.ListDanhMuc.KhoHang, false, "", "");
                this.CboKho.SelectedValue = LVYModule.ReturnIfNull(modGeneral.H_STOCKID, "", modGeneral.TypeOfValue.Nothing).ToString().Trim();
                this.CboHienThi.Items.Clear();
                this.CboHienThi.Items.Add(modGeneral.Tranlated("Chỉ hiển thị c\x00e1c mặt h\x00e0ng đang về kho", ""));
                this.CboHienThi.Items.Add(modGeneral.Tranlated("Hiển thị c\x00e1c mặt h\x00e0ng tồn kho", ""));
                this.CboHienThi.Items.Add(modGeneral.Tranlated("Hiển thị tất cả", ""));
                this.CboHienThi.SelectedIndex = 0;
            }
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_HangTrenDuongVe));
            this.Panel1 = new Panel();
            this.CmdPrint = new Button();
            this.CmdCancel = new Button();
            this.Label2 = new Label();
            this.CboHienThi = new ComboBox();
            this.Label1 = new Label();
            this.CboKho = new ComboBox();
            this.CmdOK = new Button();
            this.Label13 = new Label();
            this.TxtNgayChungTu = new DateTimePicker();
            this.VSlist = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.Panel2 = new Panel();
            this.txtTimTen = new TextBox();
            this.TxtTimMa = new TextBox();
            this.Panel1.SuspendLayout();
            this.VSlist.BeginInit();
            this.Panel2.SuspendLayout();
            this.SuspendLayout();
            this.Panel1.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgleft;
            this.Panel1.Controls.Add(this.CmdPrint);
            this.Panel1.Controls.Add(this.CmdCancel);
            this.Panel1.Controls.Add(this.Label2);
            this.Panel1.Controls.Add(this.CboHienThi);
            this.Panel1.Controls.Add(this.Label1);
            this.Panel1.Controls.Add(this.CboKho);
            this.Panel1.Controls.Add(this.CmdOK);
            this.Panel1.Controls.Add(this.Label13);
            this.Panel1.Controls.Add(this.TxtNgayChungTu);
            this.Panel1.Dock = DockStyle.Top;
            Point point = new Point(0, 0);
            this.Panel1.Location = point;
            this.Panel1.Name = "Panel1";
            Size size = new Size(0x37e, 0x2d);
            this.Panel1.Size = size;
            this.Panel1.TabIndex = 0;
            this.CmdPrint.Image = ACCOUNTING.My.Resources.Resources.view;
            this.CmdPrint.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x2d5, 0x13);
            this.CmdPrint.Location = point;
            this.CmdPrint.Name = "CmdPrint";
            size = new Size(0x55, 0x18);
            this.CmdPrint.Size = size;
            this.CmdPrint.TabIndex = 0x42;
            this.CmdPrint.Text = "&In";
            this.CmdPrint.UseVisualStyleBackColor = true;
            this.CmdCancel.DialogResult = DialogResult.Cancel;
            this.CmdCancel.Image = ACCOUNTING.My.Resources.Resources.Closed;
            this.CmdCancel.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x32c, 0x13);
            this.CmdCancel.Location = point;
            this.CmdCancel.Name = "CmdCancel";
            size = new Size(0x4f, 0x18);
            this.CmdCancel.Size = size;
            this.CmdCancel.TabIndex = 0x41;
            this.CmdCancel.Text = "Th&o\x00e1t";
            this.CmdCancel.UseVisualStyleBackColor = true;
            this.Label2.AutoSize = true;
            this.Label2.BackColor = Color.Transparent;
            this.Label2.ForeColor = Color.Black;
            point = new Point(0x131, 5);
            this.Label2.Location = point;
            this.Label2.Name = "Label2";
            size = new Size(0x2b, 13);
            this.Label2.Size = size;
            this.Label2.TabIndex = 0x40;
            this.Label2.Text = "Hiển thị";
            this.CboHienThi.FormattingEnabled = true;
            point = new Point(0x134, 0x15);
            this.CboHienThi.Location = point;
            this.CboHienThi.Name = "CboHienThi";
            size = new Size(0xe5, 0x15);
            this.CboHienThi.Size = size;
            this.CboHienThi.TabIndex = 0x3f;
            this.Label1.AutoSize = true;
            this.Label1.BackColor = Color.Transparent;
            this.Label1.ForeColor = Color.Black;
            point = new Point(0x62, 5);
            this.Label1.Location = point;
            this.Label1.Name = "Label1";
            size = new Size(0x35, 13);
            this.Label1.Size = size;
            this.Label1.TabIndex = 0x3e;
            this.Label1.Text = "Kho h\x00e0ng";
            this.CboKho.FormattingEnabled = true;
            point = new Point(0x65, 0x15);
            this.CboKho.Location = point;
            this.CboKho.Name = "CboKho";
            size = new Size(0xc6, 0x15);
            this.CboKho.Size = size;
            this.CboKho.TabIndex = 0x3d;
            this.CmdOK.Image = ACCOUNTING.My.Resources.Resources.report;
            this.CmdOK.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x271, 0x13);
            this.CmdOK.Location = point;
            this.CmdOK.Name = "CmdOK";
            size = new Size(0x62, 0x18);
            this.CmdOK.Size = size;
            this.CmdOK.TabIndex = 60;
            this.CmdOK.Text = "&Xem nhanh";
            this.CmdOK.UseVisualStyleBackColor = true;
            this.Label13.AutoSize = true;
            this.Label13.BackColor = Color.Transparent;
            this.Label13.ForeColor = Color.Black;
            point = new Point(4, 5);
            this.Label13.Location = point;
            this.Label13.Name = "Label13";
            size = new Size(0x4e, 13);
            this.Label13.Size = size;
            this.Label13.TabIndex = 0x35;
            this.Label13.Text = "T\x00ednh đến ng\x00e0y";
            this.TxtNgayChungTu.Enabled = false;
            this.TxtNgayChungTu.Format = DateTimePickerFormat.Short;
            point = new Point(7, 0x15);
            this.TxtNgayChungTu.Location = point;
            this.TxtNgayChungTu.Name = "TxtNgayChungTu";
            size = new Size(0x57, 20);
            this.TxtNgayChungTu.Size = size;
            this.TxtNgayChungTu.TabIndex = 0x34;
            this.VSlist.AllowEditing = false;
            this.VSlist.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.XpThemes;
            this.VSlist.ColumnInfo = manager.GetString("VSlist.ColumnInfo");
            this.VSlist.Dock = DockStyle.Fill;
            this.VSlist.ExtendLastCol = true;
            this.VSlist.FocusRect = FocusRectEnum.None;
            this.VSlist.KeyActionEnter = KeyActionEnum.MoveAcross;
            point = new Point(0, 0x2d);
            this.VSlist.Location = point;
            this.VSlist.Name = "VSlist";
            this.VSlist.Rows.Count = 1;
            this.VSlist.Rows.DefaultSize = 0x11;
            this.VSlist.SelectionMode = SelectionModeEnum.Row;
            size = new Size(0x37e, 0x1ec);
            this.VSlist.Size = size;
            this.VSlist.StyleInfo = manager.GetString("VSlist.StyleInfo");
            this.VSlist.TabIndex = 0x20;
            this.VSlist.VisualStyle = VisualStyle.Office2007Blue;
            this.Panel2.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgleft;
            this.Panel2.Controls.Add(this.txtTimTen);
            this.Panel2.Controls.Add(this.TxtTimMa);
            this.Panel2.Dock = DockStyle.Bottom;
            point = new Point(0, 0x219);
            this.Panel2.Location = point;
            this.Panel2.Name = "Panel2";
            size = new Size(0x37e, 0x1f);
            this.Panel2.Size = size;
            this.Panel2.TabIndex = 0x21;
            point = new Point(0x68, 6);
            this.txtTimTen.Location = point;
            this.txtTimTen.Name = "txtTimTen";
            size = new Size(300, 20);
            this.txtTimTen.Size = size;
            this.txtTimTen.TabIndex = 1;
            point = new Point(3, 6);
            this.TxtTimMa.Location = point;
            this.TxtTimMa.Name = "TxtTimMa";
            size = new Size(100, 20);
            this.TxtTimMa.Size = size;
            this.TxtTimMa.TabIndex = 0;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            size = new Size(0x37e, 0x238);
            this.ClientSize = size;
            this.ControlBox = false;
            this.Controls.Add(this.VSlist);
            this.Controls.Add(this.Panel2);
            this.Controls.Add(this.Panel1);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "Frm_HangTrenDuongVe";
            this.ShowIcon = false;
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Tag = "BC-MH03";
            this.Text = "TRA CUU HANG TREN DUONG VE";
            this.Panel1.ResumeLayout(false);
            this.Panel1.PerformLayout();
            this.VSlist.EndInit();
            this.Panel2.ResumeLayout(false);
            this.Panel2.PerformLayout();
            this.ResumeLayout(false);
        }

        public void LoadData()
        {
            this.pData = ReportModule.GetDataHangVeKho(LVYModule.Date2Char(this.TxtNgayChungTu.Text), modGeneral.H_CLIENT, LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboKho.SelectedValue), "", modGeneral.TypeOfValue.String).ToString().Trim(), this.CboHienThi.SelectedIndex);
            if (this.pData != null)
            {
                this.VSlist.DataSource = this.pData;
                C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
                vSlist.Cols[0].Width = 100;
                vSlist.Cols[1].Width = 300;
                vSlist.Cols[2].Width = 80;
                vSlist.Cols[3].Width = 100;
                vSlist.Cols[4].Width = 100;
                vSlist[0, 0] = modGeneral.Tranlated("M\x00e3 h\x00e0ng", "");
                vSlist[0, 1] = modGeneral.Tranlated("T\x00ean h\x00e0ng", "");
                vSlist[0, 2] = modGeneral.Tranlated("ĐVT", "");
                vSlist[0, 3] = modGeneral.Tranlated("Gi\x00e1 b\x00e1n", "");
                vSlist[0, 4] = modGeneral.Tranlated("Số lượng tồn", "");
                vSlist[0, 5] = modGeneral.Tranlated("Số lượng đặt h\x00e0ng", "");
                vSlist[0, 6] = modGeneral.Tranlated("Ng\x00e0y về kho", "");
                vSlist.Cols[3].DataType = System.Type.GetType("System.Decimal");
                vSlist.Cols[3].Format = modGeneral.H_FORMATNUMBER;
                vSlist.Cols[4].DataType = System.Type.GetType("System.Decimal");
                vSlist.Cols[4].Format = modGeneral.H_FORMATNUMBER;
                vSlist.Cols[5].DataType = System.Type.GetType("System.Decimal");
                vSlist.Cols[5].Format = modGeneral.H_FORMATNUMBER;
                vSlist = null;
            }
        }

        public void PrintReport()
        {
            if (this.pData != null)
            {
                this.Cursor = Cursors.WaitCursor;
                if (this.pData.Rows.Count == 0)
                {
                    LVYModule.ShowWarning(modGeneral.Tranlated("Kh\x00f4ng c\x00f3 dữ liệu !", ""));
                }
                else
                {
                    Rpt_BangKeHangSapVeKho kho = new Rpt_BangKeHangSapVeKho();
                    try
                    {
                        kho.SetDataSource(this.pData);
                        kho.Subreports[0].SetDataSource(modGeneral.H_DATACOMPANY);
                        if (modGeneral.H_LANGUAGE == "VIET")
                        {
                            kho.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEVIET, ""));
                        }
                        else
                        {
                            kho.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEANH, ""));
                        }
                        kho.SetParameterValue(1, modGeneral.Tranlated("Địa chỉ", "") + ": " + modGeneral.H_ADDRESS);
                        kho.SetParameterValue(2, modGeneral.Tranlated("M\x00e3 số thuế", "") + ": " + modGeneral.H_TAXCODE);
                        kho.SetParameterValue(3, modGeneral.Tranlated("Điện thoại", "") + ": " + modGeneral.H_TELEPHONE);
                        kho.SetParameterValue(4, modGeneral.Tranlated("Fax", "") + ": " + modGeneral.H_FAX);
                        kho.SetParameterValue(5, modGeneral.Tranlated("BẢNG K\x00ca H\x00c0NG TỒN KHO", ""));
                        kho.SetParameterValue(6, modGeneral.Tranlated("T\x00ednh đến ng\x00e0y", "") + " : " + this.TxtNgayChungTu.Text);
                        kho.SetParameterValue(7, modGeneral.Tranlated("Kho h\x00e0ng", "") + ":" + this.CboKho.Text);
                        kho.SetParameterValue(8, modGeneral.Tranlated("STT", ""));
                        kho.SetParameterValue(9, modGeneral.Tranlated("M\x00e3 h\x00e0ng", ""));
                        kho.SetParameterValue(10, modGeneral.Tranlated("T\x00ean h\x00e0ng", ""));
                        kho.SetParameterValue(11, modGeneral.Tranlated("ĐVT", ""));
                        kho.SetParameterValue(12, modGeneral.Tranlated("Số lượng tồn", ""));
                        kho.SetParameterValue(13, modGeneral.Tranlated("Số đặt h\x00e0ng", ""));
                        kho.SetParameterValue(14, modGeneral.Tranlated("Ng\x00e0y về kho", ""));
                        kho.SetParameterValue(15, modGeneral.Tranlated("Ng\x00e0y .... th\x00e1ng .... năm ............", ""));
                        kho.SetParameterValue(0x10, modGeneral.Tranlated("Lập biểu", ""));
                        MyProject.Forms.Frm_ViewReport.ReportViewer.ReportSource = kho;
                        MyProject.Forms.Frm_ViewReport.ReportViewer.DisplayGroupTree = false;
                        this.Cursor = Cursors.Default;
                        MyProject.Forms.Frm_ViewReport.ShowDialog();
                    }
                    catch (Exception exception1)
                    {
                        ProjectData.SetProjectError(exception1);
                        Exception exception = exception1;
                        MessageBox.Show(exception.Message.ToString());
                        ProjectData.ClearProjectError();
                    }
                }
            }
        }

        internal virtual ComboBox CboHienThi
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboHienThi;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CboHienThi = value;
            }
        }

        internal virtual ComboBox CboKho
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboKho;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CboKho = value;
            }
        }

        internal virtual Button CmdCancel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdCancel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdCancel_Click);
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click -= handler;
                }
                this._CmdCancel = value;
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click += handler;
                }
            }
        }

        internal virtual Button CmdOK
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdOK;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdOK_Click);
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click -= handler;
                }
                this._CmdOK = value;
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click += handler;
                }
            }
        }

        internal virtual Button CmdPrint
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdPrint;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdPrint_Click);
                if (this._CmdPrint != null)
                {
                    this._CmdPrint.Click -= handler;
                }
                this._CmdPrint = value;
                if (this._CmdPrint != null)
                {
                    this._CmdPrint.Click += handler;
                }
            }
        }

        internal virtual Label Label1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label1 = value;
            }
        }

        internal virtual Label Label13
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label13;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label13 = value;
            }
        }

        internal virtual Label Label2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label2 = value;
            }
        }

        internal virtual Panel Panel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel1 = value;
            }
        }

        internal virtual Panel Panel2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel2 = value;
            }
        }

        internal virtual DateTimePicker TxtNgayChungTu
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtNgayChungTu;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtNgayChungTu = value;
            }
        }

        internal virtual TextBox TxtTimMa
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtTimMa;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtTimMa = value;
            }
        }

        internal virtual TextBox txtTimTen
        {
            [DebuggerNonUserCode]
            get
            {
                return this._txtTimTen;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._txtTimTen = value;
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VSlist
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VSlist;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._VSlist = value;
            }
        }
    }
}

